﻿<%@ Page Title="Danh sách các thành viên" Language="C#" AutoEventWireup="true" CodeBehind="MemberList.aspx.cs" Inherits="VIT.Web.Admin.MemberList" %>
<%@ Register Assembly="VIT.Web.Controls" Namespace="VIT.Web.Controls" TagPrefix="VIT" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript" src="<%=URLRoot %>Admin/Includes/VIT.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <form id="aspnetForm" runat="server">
         <div>           
            <div class="toolbar">
                <VIT:Submit ID="Lock" runat="server" Function="Member_Modify" ToolTip="Khóa tài khoản" CssClass="icon-32-lock" BorderStyle="None" OnClick="Lock_Click" OnClientClick="return hasCheck('itemCheckbox','Vui lòng chọn tài khoản để khóa.');"/>
                <VIT:Submit ID="Unlock" runat="server" Function="Member_Modify" ToolTip="Mở khóa" CssClass="icon-32-unlock" BorderStyle="None" OnClick="Unlock_Click" OnClientClick="return hasCheck('itemCheckbox','Vui lòng chọn tài khoản để mở.');"/>
                <VIT:Submit ID="Delete" runat="server" Function="Member_Delete" ToolTip="Xóa" CssClass="icon-32-delete" BorderStyle="None" OnClick="Delete_Click" OnClientClick="return hasCheck('itemCheckbox','Vui lòng chọn mục để xóa.')  && confirm('Xóa tài khoản được chọn');"/>                
            </div>
        </div>
        <div class="clr"></div>

        <div>
            <asp:ObjectDataSource ID="ODS" runat="server" SortParameterName="SortColumn" SelectMethod="GetData" TypeName="VIT.Web.Admin.MemberList"></asp:ObjectDataSource>
            <table>                
                <asp:ListView ID="ListView" runat="server" DataSourceID="ODS">
                    <LayoutTemplate>
                        <thead>
	                        <tr>
		                        <th width="2%">#</th>
		                        <th width="2%">
			                        <input type="checkbox" name="toggle" id="toggle" onclick="checkAll('toggle', 'itemCheckbox')"/>
	                            </th>                   
		                        <th width="20%">
                                    <asp:LinkButton ID="lnkUserName" runat="server" CommandName="Sort" CommandArgument="Username" Text="Tài khoản" />
                                </th>
		                        <th>
                                    <asp:LinkButton ID="lnkEmail" runat="server" CommandName="Sort" CommandArgument="Email" Text="Email" />
                                </th>
                                <th>
                                    <asp:LinkButton ID="lnkCreateDate" runat="server" CommandName="Sort" CommandArgument="CreateDate" Text="Ngày đăng ký" />
                                </th>
                                <th>
                                    <asp:LinkButton ID="lnkActiveCode" runat="server" CommandName="Sort" CommandArgument="ActiveCode" Text="Mã kích hoạt" />
                                </th>
                                <th>
                                    <asp:LinkButton ID="lnkStatus" runat="server" CommandName="Sort" CommandArgument="Locked" Text="Tình trạng" />
                                </th>                                
                                <th width="10%">
                                    Id
                                </th>
		                        <th width="10%">Thông tin</th>
	                        </tr>			
                        </thead>
                        <asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
                    </LayoutTemplate>
                    
                    <ItemTemplate>
                        <tr class="row<%#Container.DataItemIndex%2 %>">
		                    <td align="center"><%#Container.DataItemIndex %></td>
	                        <td align="center">
		                        <input type="checkbox" name="itemCheckbox" value="<%#Eval("Id")%>" />
                            </td>
	                        <td align="left"><%#Eval("UserName")%></td>
	                        <td align="left"><%#Eval("Email")%></td>
	                        <td align="left"><%#Eval("CreateDate")%></td>
	                        <td align="center">
                                <VIT:LinkSubmit ID="changeActiveCode" Function="Member_Modify" OnClick="changeActiveCode_Click" runat="server" Param='<%#Eval("Id")%>' ToolTip="Click để kích hoạt tài khoản">
                                    <%#Eval("ActiveCode")%>
                                </VIT:LinkSubmit>
                            </td>
                            <td align="center">
                                <VIT:LinkSubmit ID="changeStatus" Function="Member_Modify" OnClick="changeStatus_Click" runat="server" Param='<%#Eval("Id")+"|"+Eval("Locked")%>'>
                                    <img alt="<%#Eval("Locked").ToString() == "True" ? "Đang bị khóa" : "Đang hoạt động" %>" src="<%#URLRoot+(Eval("Locked").ToString() == "True" ? "Admin/Includes/icons/Locked.png" : "Admin/Includes/icons/Unlocked.png")%>" />
                                </VIT:LinkSubmit>
                            </td>
                            <td align="center"><%#Eval("Id")%></td>
		                    <td align="center"><a href='MemberInfo.aspx?sId=<%#Eval("Id")%>'>Xem</a></td>	
                        </tr>
                    </ItemTemplate> 
                </asp:ListView>                
            </table>
            <asp:DataPager ID="Pager" runat="server" PagedControlID="ListView" PageSize="20" onprerender="Pager_PreRender">
                <Fields>
                    <asp:NextPreviousPagerField ShowFirstPageButton="True" ShowNextPageButton="False" FirstPageText="Trang đầu" PreviousPageText="<<" />
                    <asp:NumericPagerField />
                    <asp:NextPreviousPagerField ShowLastPageButton="True" ShowPreviousPageButton="False" LastPageText="Trang cuối" NextPageText=">>" />
                </Fields>
            </asp:DataPager>
        </div>
    </form>
    <script type="text/javascript">
        $("#aside ul li#MemberList").addClass("submenu-active");
    </script>
</asp:Content>
